package com.by.test;

import com.qiniu.common.QiniuException;
import com.qiniu.common.Zone;
import com.qiniu.storage.BucketManager;
import com.qiniu.storage.Configuration;
import com.qiniu.util.Auth;

public class QiNiuTest2 {
    public static void main(String[] args) {
        //构造一个带指定 Region 对象的配置类
        Configuration cfg = new Configuration(Zone.zone1());
        //...其他参数参考类注释
        //...生成上传凭证，然后准备上传
        String accessKey = "_Sf1Kv7xI-lnveO6WdittW4liLjk5cuQon0LpfIi";
        String secretKey = "TfqMsJP2plpKBCt-FR8rPSzRbGGcgE6Lo7VAvNzl";
        //创建的存储空间的名称
        String bucket = "pl-ican-0111";
        String key = "Foj0UL0RxPZAmKz3eodSywnItomC";
        Auth auth = Auth.create(accessKey, secretKey);
        BucketManager bucketManager = new BucketManager(auth, cfg);
        try {
            bucketManager.delete(bucket, key);
        } catch (
                QiniuException ex) {
            //如果遇到异常，说明删除失败
            System.err.println(ex.code());
            System.err.println(ex.response.toString());
        }
    }
}
